<template>
  <div style="overflow:hidden">
    <div style="float: left">
      <prod
        v-for="(obj, index) in list"
        :key="obj.id"
        :title="obj.proname"
        :price="obj.proprice"
        :intro="obj.info"
        :index="index"
        @updata="uppice"
      ></prod>
    </div>

    <div style="float: left">
      <list :arr="list"></list>
    </div>
  </div>
</template>

<script>
import prod from "./components/mypordte/Props.vue";
import list from "./components/list/List";
export default {
  data() {
    return {
      list: [
        { id: 1, proname: "冰淇淋", proprice: "14.2", info: "好吃不腻" },
        { id: 2, proname: "德芙巧克力", proprice: "14.2", info: "好吃不腻" },
        { id: 3, proname: "可爱多", proprice: "14.2", info: "好喝不腻" },
      ],
    };
  },
  components: {
    prod,
    list,
  },
  methods: {
    uppice(i, p) {
      if (this.list[i].proprice > 1) {
        this.list[i].proprice = (this.list[i].proprice -= p).toFixed(2);
      }
    },
  },
};
</script>

<style>
</style>